import pymysql



host = "localhost"
user = "root"
password = "root"
database = "baofuzhai"

def selectall(sql):
    db = pymysql.connect(host=host, user=user, password=password, database=database)
    cursor = db.cursor()
    cursor.execute(sql)
    data = cursor.fetchall()
    cursor.close()
    db.close()
    return data
def select(sql,prom):
    db = pymysql.connect(host=host, user=user, password=password, database=database)
    cursor = db.cursor()
    cursor.execute(sql,prom)
    data = cursor.fetchall()
    cursor.close()
    db.close()
    return data

def update(sql,data):
    db = pymysql.connect(host=host, user=user, password=password, database=database)
    cursor = db.cursor()
    cursor.execute(sql,data)
    db.commit()
    cursor.close()
    db.close()













